package pt.ipleiria.plp.threads;

import pt.ipleiria.plp.BlackSpotterMidlet;
import pt.ipleiria.plp.Lixeiras.LixeiraPeddingComplete;
import pt.ipleiria.plp.Lixeiras.LixeiraSendResult;

/**
 * Thread For sending a the lixeira
 */
public class SendLixeira extends Thread {

    private LixeiraPeddingComplete lix;
    private CallbackConfirm screen;
    private BlackSpotterMidlet midlet;

    public SendLixeira(LixeiraPeddingComplete lix, CallbackConfirm screen,
            BlackSpotterMidlet midlet) {
        this.lix = lix;
        this.screen = screen;
        this.midlet = midlet;
    }

    public void run() {

        String error = midlet.getApp().getManager().sendLixeira(lix);

        if (error != null) {
            screen.returnConfimation(error);
        } else {
            screen.returnConfimation(null);
        }

    }
}
